package com.finance.cooperate.dao.repository.primary;

import com.finance.cooperate.dao.entity.primary.Device;
import com.finance.cooperate.dao.support.jpa.BaseRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

import java.util.Date;
import java.util.List;

/**
 * @InterfaceName DeviceRepository
 * @Description 设备仓库
 * @Author shen
 * @Date 2023/8/6 21:18
 * @Modify ...
 */
@Repository
public interface DeviceRepository extends BaseRepository<Device, Long> {


    @Query(value = "SELECT p FROM Device p WHERE p.userId = ?1 and p.deviceId = ?2 AND p.createTime <= ?3 ORDER BY p.createTime DESC")
    List<Device> getDevice(String uid, String deviceId, Date createTime);

}
